<template>
  <div>
    home
    <button @click="handleClick">添加数据</button>
  </div>
</template>

<script>
export default {
  created() {
    console.log('home---------------------------')
    // 初始化 vuex中的actions数据接口
    this.$store.dispatch('getCartList', { page: 1, size: 5 }).then((res) => {
      console.log('res:', res)
    })
  },
  methods: {
    handleClick() {
      this.$store.commit('set_list', {
        id: Date.now(),
        name: 'ipone_' + Date.now(),
      })
    },
  },
}
</script>
